using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace BMC.ARSystem
{
	[ClassInterface, Guid("7fb78d89-812a-4e37-b3ac-9931edeeec5e"), ProgId("BMC.ARSystem.StatusHistory")]
	public class StatusHistory : CollectionBase
	{
		[Guid("be9f5511-4917-46e1-b346-b72c3fc46a50")]
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;
			public StatusHistoryItem Current
			{
				get
				{
					return (StatusHistoryItem)this.wrapped.get_Current();
				}
			}
			object IEnumerator.Current
			{
				get
				{
					return (StatusHistoryItem)this.wrapped.get_Current();
				}
			}
			public Enumerator(StatusHistory collection)
			{
				this.wrapped = collection.GetEnumerator();
			}
			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}
			public void Reset()
			{
				this.wrapped.Reset();
			}
		}
		public virtual StatusHistoryItem this[int index]
		{
			get
			{
				return (StatusHistoryItem)base.get_List().get_Item(index);
			}
		}
		public virtual bool Contains(StatusHistoryItem value)
		{
			return base.get_List().Contains(value);
		}
		public virtual int IndexOf(StatusHistoryItem value)
		{
			return base.get_List().IndexOf(value);
		}
		public virtual StatusHistory.Enumerator GetEnumerator()
		{
			return new StatusHistory.Enumerator(this);
		}
		internal virtual void Add(StatusHistoryItem value)
		{
			base.get_List().Add(value);
		}
		public static StatusHistory Decode(string encoded)
		{
			StatusHistory statusHistory = new StatusHistory();
			string[] array = encoded.Split(new char[]
			{
				'\u0003'
			});
			int num = (array != null && array.Length > 0) ? array.Length : 0;
			if (num > 0 && array[num - 1].get_Length() <= 0)
			{
				num--;
			}
			for (int i = 0; i < num; i++)
			{
				string text = array[i];
				string[] array2 = text.Split(new char[]
				{
					'\u0004'
				});
				if (!text.Equals("") && array2.Length >= 1)
				{
					DateTime dateTime = Util.GetDateTime(Convert.ToUInt32(array2[0]));
					string combinedStringFromParts = Util.GetCombinedStringFromParts(array2, 1, '\u0004');
					StatusHistoryItem value = new StatusHistoryItem(combinedStringFromParts, dateTime);
					statusHistory.Add(value);
				}
				else
				{
					statusHistory.Add(new StatusHistoryItem("", DateTime.MaxValue));
				}
			}
			return statusHistory;
		}
		internal string Encode()
		{
			string text = "";
			DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0);
			foreach (StatusHistoryItem current in this)
			{
				if (current.Time != DateTime.MaxValue)
				{
					text += (current.Time - dateTime).get_TotalSeconds();
					text += '\u0004';
					text += current.User;
				}
				text += '\u0003';
			}
			return text;
		}
		[DispId(0)]
		public override string ToString()
		{
			string text = "";
			foreach (StatusHistoryItem current in this)
			{
				object obj = text;
				text = string.Concat(new object[]
				{
					obj,
					current.Time.ToLocalTime(),
					"\t",
					current.User,
					"\n"
				});
			}
			return text;
		}
	}
}
